import request from '@/utils/request'
import type { CleanupTask, CleanupStaff, PaginationResponse } from '@/types'

// 获取清运任务列表
export const getCleanupTasks = (params: any): Promise<PaginationResponse<CleanupTask>> => {
  return request.get('/cleanup/tasks', { params })
}

// 创建清运任务
export const createCleanupTask = (data: any): Promise<void> => {
  return request.post('/cleanup/tasks', data)
}

// 更新清运任务
export const updateCleanupTask = (id: number, data: any): Promise<void> => {
  return request.put(`/cleanup/tasks/${id}`, data)
}

// 分配清运任务
export const assignCleanupTask = (id: number, staffId: number): Promise<void> => {
  return request.put(`/cleanup/tasks/${id}/assign`, { staffId })
}

// 完成清运任务
export const completeCleanupTask = (id: number): Promise<void> => {
  return request.put(`/cleanup/tasks/${id}/complete`)
}

// 获取清运员列表
export const getCleanupStaff = (): Promise<CleanupStaff[]> => {
  return request.get('/cleanup/staff')
}

// 创建清运员
export const createCleanupStaff = (data: any): Promise<void> => {
  return request.post('/cleanup/staff', data)
}

// 更新清运员
export const updateCleanupStaff = (id: number, data: any): Promise<void> => {
  return request.put(`/cleanup/staff/${id}`, data)
}

// 删除清运员
export const deleteCleanupStaff = (id: number): Promise<void> => {
  return request.delete(`/cleanup/staff/${id}`)
}

// 获取清运统计
export const getCleanupStats = (): Promise<any> => {
  return request.get('/cleanup/statistics')
}